package pl.edu.agh.uddiProxy;

import java.net.MalformedURLException;

import dk.itst.uddi.client.ConnectionInfo;

public class UDDIClient {
	private static dk.itst.uddi.client.UDDIClient client;

	private PublicationClient publicationClient;

	private UpdateClient updateClient;
	
	private InquiryClient inquiryClient;

	public UDDIClient(String username, String password, ConnectionInfo info)
			throws MalformedURLException {
		client = new dk.itst.uddi.client.UDDIClient(username, password, info);
	}

	public PublicationClient getPublication() {
		if (publicationClient == null) {
			dk.itst.uddi.client.PublicationClient publicationClient = client
					.getPublication();
			this.publicationClient = new PublicationClient(publicationClient);
		}
		
		return publicationClient;
	}

	public UpdateClient getUpdate() {
		if (updateClient == null) {
			updateClient = new UpdateClient();
		}
		return updateClient;
	}

	public InquiryClient getInquiryClient() {
		if (inquiryClient == null) {
			this.inquiryClient = new InquiryClient();
		}
		return inquiryClient;
	}

	public static dk.itst.uddi.client.UDDIClient getClient() {
		return client;
	}
	
}
